package com.xncoding.rocketmq.Listener;

import com.xncoding.rocketmq.entity.User;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(consumerGroup = "${rocketmq.producer.groupName}", topic = "${rocketmq.consumer.topicLog}")
public class UserMqListener implements RocketMQListener<User> {
    @Override
    public void onMessage(User user) {
        System.out.println("----------------------------------");
        System.out.println("接收到消息，开始消费..name:" + user.getName() + ",age:" + user.getAge());
    }
}
